package co.com.inventarios.modelo;

import java.sql.Timestamp;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Mngcco entity.
 * 
 * @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "MNGCCO", schema = "MANAGER", uniqueConstraints = {})
public class Mngcco implements java.io.Serializable {

	// Fields

	private String ccocodigo;
	private String cconombre;
	private Long ccoactivo;
	private Timestamp ccologfec;
	private Dlluser dlluser;
	private Set<RequiDoc> requiDocs = new HashSet<RequiDoc>(0);

	// Constructors

	/** default constructor */
	public Mngcco() {
	}

	/** minimal constructor */
	public Mngcco(String ccocodigo) {
		this.ccocodigo = ccocodigo;
	}

	/** full constructor */
	public Mngcco(String ccocodigo, String cconombre, Long ccoactivo,
			Dlluser dlluser,Timestamp ccologfec,
			Set<RequiDoc> requiDocs) {
		this.ccocodigo = ccocodigo;
		this.dlluser = dlluser;
		this.ccologfec = ccologfec;
		this.cconombre = cconombre;
		this.ccoactivo = ccoactivo;
		this.requiDocs = requiDocs;
	}

	// Property accessors
	@Id
	@Column(name = "CCOCODIGO", unique = true, nullable = false, insertable = true, updatable = true, length = 20)
	public String getCcocodigo() {
		return this.ccocodigo;
	}

	public void setCcocodigo(String ccocodigo) {
		this.ccocodigo = ccocodigo;
	}

	@Column(name = "CCONOMBRE", unique = false, nullable = true, insertable = true, updatable = true, length = 100)
	public String getCconombre() {
		return this.cconombre;
	}

	public void setCconombre(String cconombre) {
		this.cconombre = cconombre;
	}

	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumn(name = "CCOLOGUSER", unique = false, nullable = true, insertable = true, updatable = true)
	public Dlluser getDlluser() {
		return this.dlluser;
	}

	public void setDlluser(Dlluser dlluser) {
		this.dlluser = dlluser;
	}

	@Column(name = "CCOLOGFEC", unique = false, nullable = true, insertable = true, updatable = true)
	public Timestamp getCcologfec() {
		return this.ccologfec;
	}

	public void setCcologfec(Timestamp ccologfec) {
		this.ccologfec = ccologfec;
	}
	
	@Column(name = "CCOACTIVO", unique = false, nullable = true, insertable = true, updatable = true, precision = 22, scale = 0)
	public Long getCcoactivo() {
		return this.ccoactivo;
	}

	public void setCcoactivo(Long ccoactivo) {
		this.ccoactivo = ccoactivo;
	}

	@OneToMany(cascade = {}, fetch = FetchType.LAZY, mappedBy = "mngcco")
	public Set<RequiDoc> getRequiDocs() {
		return this.requiDocs;
	}

	public void setRequiDocs(Set<RequiDoc> requiDocs) {
		this.requiDocs = requiDocs;
	}

//	public int compareTo(Object o) { 
//		Mngcco ordercodigo = (Mngcco)o;        
//         
//            if(this.cconombre.compareToIgnoreCase(ordercodigo.cconombre) == 0) { 
//                return this.ccocodigo.compareTo(ordercodigo.ccocodigo); 
//            } else { 
//                return this.cconombre.compareToIgnoreCase(ordercodigo.cconombre); 
//            } 
//    } 


	
	
	
}